/**
 * 
 */
package org.vsg.stock.basic.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.vsg.common.biz.exception.ServiceException;
import org.vsg.stock.basic.domain.RealStockInfo;
import org.vsg.stock.basic.domain.StockCategory;
import org.vsg.stock.basic.domain.StockInfo;
import org.vsg.stock.basic.persistence.StockCategoryDao;
import org.vsg.stock.basic.persistence.StockInfoDao;

/**
 * @author Bill Vison
 *
 */
@Service(value="stockInfoService")
public class StockInfoServiceImpl implements StockInfoService {

	
	@Resource
	private StockCategoryDao stockCategoryDao;
	
	@Resource
	private StockInfoDao stockInfoDao;
	
	
	/* (non-Javadoc)
	 * @see org.vsg.stock.basic.service.StockInfoService#getAssoStockInfoByCategoryId(int)
	 */
	@Override
	public List<RealStockInfo> getAssoStockInfoByCategoryId(int categoryId)
			throws ServiceException {
		// TODO Auto-generated method stub
		StockCategory category = (StockCategory)stockCategoryDao.load(StockCategory.class, categoryId);
		List<RealStockInfo> result = category.getAssoStockInfos();
		
		return result;
	}

	@Override
	public StockInfo loadStockInfo(String pk) throws ServiceException {
		// TODO Auto-generated method stub
		return (StockInfo)stockInfoDao.load(StockInfo.class, pk);
	}

	
	
}
